package cn.lyh.gulimall.coupon.controller;

import cn.lyh.gulimall.coupon.entity.SmsCoupon;
import cn.lyh.gulimall.coupon.service.SmsCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import utils.R;

import java.util.Arrays;

/**
 * @author lyh
 * @version 1.0
 * @since 2021/4/6
 */
@RefreshScope
@RestController
@RequestMapping("/coupon/sms")
public class CouponController {

	@Autowired
	SmsCouponService couponService;

	@Value("${coupon.user.name}")
	private String name;
	@Value("${coupon.user.age}")
	private Integer age;


	@GetMapping("/coupon/list")
	public R getCouponList(){
		SmsCoupon smsCoupon = new SmsCoupon();
		smsCoupon.setCouponName("test");
		return R.ok().put("coupons", Arrays.asList(smsCoupon));
	}

	@RequestMapping("/nacos/config")
	public R testNacosConfig(){
		return R.ok().put("name",name).put("age",age);
	}


}
